<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>插槽的基本使用</title>
    <script src="https://cdn.staticfile.org/vue/2.2.2/vue.min.js"></script>
</head>
<body>
    <div id="app">
        <cpn2><button>按钮</button></cpn2>
        <cpn2><span>hhhh</span></cpn2>
        <cpn2><i>呵呵呵</i></cpn2>
        <cpn2><button>按钮</button></cpn2>
    </div>
    
    <template id="cpn2">
        <div>
            <h2>我是组件</h2>
            <p>我是组件哈哈哈</p>
            <!-- slot中放的是默认值，如果和组件中的不一样，会被组件中的覆盖 -->
            <slot><button>按钮</button></slot>
        </div>
    </template>
    <script>
       
        const app = new Vue({
            el: "#app",
            data: {
                
            },
            components:{//局部组件注册语法糖
                cpn2:{
                    template: "#cpn2"
                }
            }
        })
    </script>
</body>
</html>